package org.utils;

import java.util.Scanner;

public class StringConcatDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串，每行一个，输入完成后按 Ctrl+D (Unix/Linux/Mac) 或 Ctrl+Z (Windows) 后回车结束：");

        StringBuilder result = new StringBuilder();
        boolean first = true;

        while (scanner.hasNextLine()) {
            String line = scanner.nextLine().trim();
            if (!line.isEmpty()) {
                if (!first) {
                    result.append(",");
                }
                result.append("\"").append(line).append("\"");
                first = false;
            }
        }

        System.out.println(result.toString());

        scanner.close();
    }
}
